﻿#if NETSTANDARD2_0 
using Microsoft.Extensions.DependencyInjection;
#endif

#if NET35
using Kernelx.Common.DependencyInjection;
#endif

namespace Kernelx.Contexts.Configuration
{
    using Defaults;
    using Newtonsoft;
    /// <summary>
    /// 
    /// </summary>
    public static class NewtonsoftExtensions
    {
        /// <summary>
        /// 注册<see cref="IJsonSerializer"/>的实现
        /// </summary>
        /// <param name="ctxOpts"></param>
        /// <returns></returns>
        public static WorkloadContextOptions RegisterJson2Newtonsoft(this WorkloadContextOptions ctxOpts)
        {
            ctxOpts.Services.AddSingleton(typeof(IJsonSerializer), new DefaultJsonSerializer());
            return ctxOpts;
        }

    }
}
